package com.falcon.domain;

import java.util.Arrays;

public class DependencyNode {

    private String groupId;

    private String artifactId;

    private String version;

    private String scope;

    public DependencyNode() {
    }

    public DependencyNode(String groupId, String artifactId) {
        this.groupId = groupId;
        this.artifactId = artifactId;
    }

    public String getGroupId() {
        return groupId;
    }

    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }

    public String getArtifactId() {
        return artifactId;
    }

    public void setArtifactId(String artifactId) {
        this.artifactId = artifactId;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getScope() {
        return scope;
    }

    public void setScope(String scope) {
        this.scope = scope;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;

        if (o == null || getClass() != o.getClass()) return false;

        DependencyNode that = (DependencyNode) o;

        String id = groupId + ":" + artifactId;

        return id.equals(that.getGroupId() + ":" + that.getArtifactId());
    }

    @Override
    public int hashCode() {
        return Arrays.deepHashCode(new Object[]{groupId, artifactId});
    }

    @Override
    public String toString() {
        return this.groupId + ":" + this.artifactId + ":" + this.version + ":" + this.scope;
    }
}
